﻿@model GC_RF.Site.Models.News.NewsModel
@{
	ViewBag.Title = "Редактирование новостей";
}

@if (Model != null)
{
	using (Html.BeginForm("Edit", "News", FormMethod.Post))
	{
		<div class="edit">
			<div class="page-header">
				<h2 class="page-title">Редактирование новостей</h2>
			</div>
			<div class="content-inner">
				<div class="row">
					@Html.ValidationSummary()
				</div>
				<div class="row">
					<div class="col-md-12">
						@Html.LabelFor(model => model.ImageUrl)
					</div>
				</div>
				<div class="row">
					<div class="col-md-3">
						@Html.LabelFor(model => model.StaticImageUrl)
					</div>
					<div class="col-md-9">
						@Html.TextBoxFor(model => model.StaticImageUrl)
						<a id="refresh-image-url" class="fa fa-refresh"></a>
					</div>
				</div>
				<div class="row">
					<div class="col-md-3">
						@Html.HiddenFor(model => model.ImageUrl)
						<img src="@Model.ImageUrl" id="img-news" />
					</div>
					<div class="col-md-9">
						<input type="file" id="uploadify" />
					</div>
				</div>
				<div class="row">
					<div class="col-md-3">
						@Html.LabelFor(model => model.Title)
					</div>
					<div class="col-md-9">
						@Html.TextBoxFor(model => model.Title)
					</div>
				</div>
				<div class="row">
					<div class="col-md-3">
						@Html.LabelFor(model => model.Preview)
					</div>
					<div class="col-md-9">
						@Html.TextAreaFor(model => model.Preview)
					</div>
				</div>
				<div class="row">
					<div class="col-md-3">
						@Html.LabelFor(model => model.Description)
					</div>
					<div class="col-md-9">
						<div class="wysiwyg">
							@Html.TextAreaFor(model => model.Description)
						</div>
					</div>
				</div>
				<div class="row">
					<div class="col-md-12">
						<input type="submit" value="Сохранить">
					</div>
				</div>
				<div class="row">
					<div class="col-md-12">
						@Html.Raw(Model.Description)
					</div>
				</div>
			</div>
		</div>
	}
}

<script type="text/javascript">
	$(document).ready(function () {
		rf.news.edit.init({
			urls: {
				swf: "@Url.Content("~/Scripts/uploadify.swf")",
				uploader: "@Url.Action("UploadFile", "News")"
			},
			vars: {
				
			},
			elements: {
				uploadify: '#uploadify',
				imgNews: '#img-news',
				tinymce: '#Description',
				hiddenImgNews: '#ImageUrl',
				refreshImageUrlSelector: '#refresh-image-url',
				staticImageUrlSelector: '#StaticImageUrl'
			}
		});
	});
</script>